package com.varian.security.model;

import cn.hutool.core.map.MapUtil;
import com.varian.tool.enums.UserStatusEnum;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Collection;
import java.util.Map;

/**
 * @author ben
 * @since 2025/2/7
 */
@Data
@Accessors(chain = true)
public class LoginUserBuilder {

    private Long userId;
    private String username;
    private String avatar;
    private String password;
    private String nickname;
    private UserStatusEnum userStatus;
    private Collection<String> authorities;
    private Map<String, Object> extra;

    public LoginUserBuilder() {
        this.extra = MapUtil.newHashMap();
    }

    public LoginUser build() {
        return new LoginUser(userId, username, avatar, password, nickname, userStatus, extra, authorities);
    }

    public LoginUserBuilder put(String key, Object value) {
        extra.put(key, value);
        return this;
    }

    public LoginUserBuilder putAll(Map<String, Object> map) {
        extra.putAll(map);
        return this;
    }
}
